package com.payment.ktb.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.payment.ktb.R;

import java.util.List;

/**
 * Created by Android Studio
 * author: fei.wang
 * Date: 2016-05-10
 * Time: 15:57
 * Description: 确认订单内部商品的弹窗
 */
public class ConfirmOrderGoodAdapter extends BaseAdapter {

    private Context context;
    private List<String> lists;

    public ConfirmOrderGoodAdapter(Context context, List<String> lists) {
        this.context = context;
        this.lists = lists;
    }

    @Override
    public int getCount() {
        return lists.size();
    }

    @Override
    public Object getItem(int position) {
        return lists.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null){
            convertView = LayoutInflater.from(context).inflate(R.layout.adapter_dialog_confirm_good,null);
            holder = new ViewHolder();
            holder.textView = (TextView) convertView.findViewById(R.id.adapter_dialog_confirm_good_text);
            convertView.setTag(holder);
        }else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.textView.setText(lists.get(position));
        return convertView;
    }

    class ViewHolder {
        TextView textView;
    }
}
